﻿using UnityEngine;
using System.Collections;

public class EndPointCollider : MonoBehaviour
{
	public bool setado = false;

		// Use this for initialization
		void Start ()
		{
				//GameController GameController = Camera.main.GetComponent<GameController> ();
		}
	
		// Update is called once per frame
		void Update ()
		{
				foreach (GameObject jogador in GameController.jogadores) {
						if (jogador == null)
								continue;
						Bounds item = this.gameObject.collider.bounds;
						Bounds player = jogador.renderer.bounds;
						if (item.Intersects (player)) {
								this.SpawnPoint2();
						}
				}
		}

		void SpawnPoint2 ()
		{
			foreach (GameObject jogador in GameController.jogadores) {
				if (jogador == null){
					continue;
				}
				GameObject spawn = GameObject.Find ("SpawnPoint2");
				jogador.transform.position = spawn.transform.position;
			}
		}
}
